using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Runtime.Serialization;

namespace ShrapnelTest
{
	[DataContract()]
	class TestConnector : Shrapnel.Connector
	{
		[DataMember()]
		private Shrapnel.Areas.Box boxArea = new Shrapnel.Areas.Box();


		public TestConnector(PointF position)
		{
			const float size = 4.0f;

			boxArea.BoxArea = new System.Drawing.RectangleF(position.X - size, position.Y - size, size * 2, size * 2);

			CableOriginOffset = new SizeF(size, size);

			OccupiedArea.Add(boxArea);
		}



		public override void Draw(System.Drawing.Graphics graphics, Shrapnel.ViewState viewState)
		{
			base.Draw(graphics, viewState);

			RectangleF areaOnScreen = viewState.WorldToScreen(boxArea.BoxArea);

			using (Pen pen = new Pen(Color.Black))
			{
				graphics.DrawRectangle(pen,
					areaOnScreen.X,
					areaOnScreen.Y,
					areaOnScreen.Width,
					areaOnScreen.Height);
			}
		}
	}
}
